package com.scau.service.impl.business;

import java.io.Serializable;

import org.springframework.stereotype.Component;

import com.scau.exception.BusinessException;
import com.scau.model.business.Client;
import com.scau.service.BaseService;
@Component
public class ClientService extends BaseService<Client> implements Serializable{
	public void save(Client client) throws BusinessException{
		if (null != client && null != client.getName()) {
			if(null != client.getId()&& 0 != client.getId()){
				update(client);
			}else{
				add(client);
			}
		}else {
			throw new BusinessException("名称不能为空");
		}
	}
	@Override
	public Client get(Client client){
		if(null!=client&&client.getId()!=null&&0!=client.getId())
		{
			client=super.get(client, client.getId());
		}else if(null!=client){
			client=super.get(client);
		}
		return client;
	}
}